<script>
$(function() {
	$( "#tabs" ).tabs({
	    select: function(event, ui) {
	        var url = $.data(ui.tab, 'load.tabs');
	        if( url ) {
	            location.href = url;
	            return false;
	        }
	        return true;
	    },
	selected: 0
	});
});
</script>
<div id="tabs">
	<ul>
        <li><a href='#file'>Danh sách files</a> </li>
        <li><?php echo $this->Html->link(__('Upload file mới', true), array('controller'=>'taptins','action' => 'upload')); ?></li>
        
	</ul>
<div class="taptins index" id="file">
	<h2><?php __('Danh sách file');?></h2>
	<table id='tables'>
	<tr>
			<th><?php echo 'STT';?></th>
			<th><?php echo 'Tiêu đề';?></th>
			<th><?php echo 'Nội dung';?></th>
			<th><?php echo 'Ngày tạo';?></th>
			<th><?php echo 'Tên file';?></th>
			<th><?php echo 'Size';?></th>
			<th class="actions"><?php __('Thao tác');?></th>
	</tr>
	<?php
	$i = 0;
	foreach ($taptins as $taptin):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
		<td><?php echo $i; ?>&nbsp;</td>
		<td><?php echo $taptin['Taptin']['tieude']; ?>&nbsp;</td>
		<td><?php echo $taptin['Taptin']['noidung']; ?>&nbsp;</td>
		<td><?php echo date('d-m-Y H:i:s',strtotime($taptin['Taptin']['ngaykt'])); ?>&nbsp;</td>
		<td><?php echo $taptin['Taptin']['tenfile']; ?>&nbsp;</td>
		<td><?php echo $taptin['Taptin']['dolon']; ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('Chi tiết', true), array('action' => 'view', $taptin['Taptin']['id'])); ?>
			<?php echo $this->Html->link(__('Download', true), array('action' => 'Download', $taptin['Taptin']['id'])); ?>
			<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete', $taptin['Taptin']['id']), null, sprintf(__('Bạn muốn xóa tập tin %s?', true), $taptin['Taptin']['tenfile'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
</div>
</div>